Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
// Code inspired from Qt5's QDir::removeRecursively
bool FileSystem::removeRecursively(const QString &path, const std::function<void(const QString &path, bool isDir)> &onDeleted, QStringList *errors)
{
+ FileSystem::setFolderPermissions(path, FileSystem::FolderPermissions::ReadWrite);
+
bool allRemoved = true;
QDirIterator di(path, QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
const auto fileInfo = QFileInfo{absolute};
const auto parentFolderPath = fileInfo.dir().absolutePath();
const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite};
- FileSystem::setFolderPermissions(absolute, FileSystem::FolderPermissions::ReadWrite);
bool success = FileSystem::removeRecursively(
absolute,
[&deleted](const QString &path, bool isDir) {